<!--
 * @Description: 
 * @Author: mxy
 * @Date: 2022-12-01 20:49:06
 * @LastEditors: mxy
 * @LastEditTime: 2022-12-01 21:02:22
-->
<template>
  <header class="header">
    <h1>任务列表</h1>
    <input
      v-model="val"
      class="new-todo"
      placeholder="请输入要做的事情"
      autofocus
      @keyup.enter="add"
    />
  </header>
</template>

<script>
export default {
  data() {
    return {
      val: "",
    };
  },
  methods: {
    add() {
      this.$emit("add", this.val);
      this.val = "";
    },
  },
};
</script>

<style>
</style>
